{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "805e246c",
   "metadata": {},
   "source": [
    "##### 用户输入方法"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "fbd346a4",
   "metadata": {},
   "outputs": [],
   "source": [
    "name = input(\"name: \")\n",
    "age = input(\"age: \")\n",
    "job = input(\"job: \")\n",
    "salary = input(\"salary: \")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4c649caf",
   "metadata": {},
   "source": [
    "##### 知识点1： 字符串拼接 用 + 让打印的结果更直观\n",
    "###### 知识点2： %s占位符，可以把 “+”符号 省略，比较直观的展示变量内容\n",
    "######          缺点： 如果变量很多，就比较麻烦了\n",
    "##### 知识点3: .format() 比起%s 更适合较多变量的打印，不需要考量顺序和出现次数\n",
    "#####          例如 : url 的拼接 (https:// + 域名 + endpoint)\n",
    "#### 例如："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ad904973",
   "metadata": {},
   "outputs": [],
   "source": [
    "info1 = '''------INFO {HTML_name} ------\n",
    " name:{HTML_name}\n",
    " age:{HTML_age}\n",
    " job:{HTML_job}\n",
    " salary:{HTML_salary}'''.format(HTML_age=age,HTML_job=job,HTML_name=name,HTML_salary=salary)\n",
    "\n",
    "print(info1)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "eb4c1b5f",
   "metadata": {},
   "source": [
    "####  数据结构之列表\n",
    "\n",
    "#### names = \"\"\n",
    "#### print(names[1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "bdcc3e8c",
   "metadata": {},
   "outputs": [],
   "source": [
    "users_list = [\"cheng\",\"youge\",\"xiaoming\"]\n",
    "password_list = [123456,789654,273843]\n",
    "age_list = [23,28,18]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5ea749e5",
   "metadata": {},
   "source": [
    "#### 列表的嵌套\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "24d61c05",
   "metadata": {},
   "outputs": [],
   "source": [
    "info_list = [[\"cheng\",123456,23],[\"youge\",123456,28]]\n",
    "\n",
    "print(users_list[0])\n",
    "print(password_list[0])\n",
    "print(age_list[0])\n",
    "print(info_list[-1])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2760eb41",
   "metadata": {},
   "source": [
    "#### 知识点 slices(切片) 数值是指 values在list中的位置"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "92bedffc",
   "metadata": {},
   "source": [
    "### 正向取值\n",
    "##### list 取值 “:”右边的值取不到 例如[1:3] 3 这个位置取不到"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b8746f13",
   "metadata": {},
   "outputs": [],
   "source": [
    "print(names[1:3])\n",
    "print(names[0:2])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6f4e2299",
   "metadata": {},
   "source": [
    "###  反向取值\n",
    "#### list 取值 “:”右边的值取不到 例如[-3:-1] -1 这个位置取不到\n",
    "#### 注意： 取到最后一个值，不能写 0 省略不写即可"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b8233a35",
   "metadata": {},
   "outputs": [],
   "source": [
    "print(names[-3:1])\n",
    "\n",
    "num = [1,2,3,4,5,6,7,8,9]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "27b6f802",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
